package com.ssy.jt808.protocol.t808;

import com.ssy.jt808.protocol.basics.JTMessage;
import com.ssy.jt808.protocol.commons.JT808;
import io.github.yezhihao.protostar.annotation.Field;
import io.github.yezhihao.protostar.annotation.Message;
import lombok.Data;

import java.util.List;

/**
 * @author yezhihao
 * https://gitee.com/yezhihao/jt808-server
 */
@Data
@Message(JT808.定位数据批量上传)
public class T0704 extends JTMessage{

  @Field(length=2, desc="数据项个数")
  private int total;
  @Field(length=1, desc="位置数据类型：0.正常位置批量汇报 1.盲区补报")
  private int type;

  @Field(lengthUnit=2, desc="位置汇报数据项")
  private List<T0200> items;

  public void setItems( List<T0200> items ){
    this.items = items;
    this.total = items.size();
  }

  // TODO: 暂时未使用
//    @Override
//    public void setPayload( ByteBuf payload ){
//        super.setPayload(payload.copy());
//    }
}